package code1;

import java.util.ArrayList;

/**
 * @author noob
 * @version 1.0
 * @date 2021/3/20 7:57
 */
public class MainTest {

    public static void main(String[] args) {
        System.out.println("Pride and Prejudice");
        ArrayList<String> words = new ArrayList<>();
        if(FileOperation.readFile("pride-and-prejudice.txt", words)){

            long startTime = System.nanoTime();

            Trie trie = new Trie();
            for(String word: words) {
                trie.add(word);
            }

            for(String word: words) {
                trie.contains(word);
            }

            long endTime = System.nanoTime();

            Double time = (endTime - startTime) / 1000000000.0;

            System.out.println("Total different words: " + trie.getSize());
            System.out.println("Trie: " + time + " s");


        }
    }
}
